faApp.controller('FissListCtrl',['$scope','fissService','$location','$controller','$routeParams','$filter',function($scope,fissService,$location,$controller,$routeParams,$filter) {   
	$controller('BaseCtrl', {$scope: $scope}); 
  $scope.code = $routeParams.code;

  //所有列的映射
  $scope.allColMap = {
    "3066":{ "prodID":"信托产品ID", "prodName":"信托产品名称", "trustCompanyName":"信托公司", "trustCompanyID":"信托公司ID", "depositOrg":"信托产品公告", "publicArea":"发行区域", "investTerm":"信托方式", "investField":"投资领域", "targetSize":"标规模", "foundMoney":"投资币种", "recommendBDate":"募集起始日", "recommendEDate":"募集终止日", "foundDate":"成立日期", "closeTime":"封闭期", "currency":"投资币种", "buyMoney":"产品起购金额", "manageFee":"固定管理费", "yieldUp":"预期收益上限", "yieldDown":"预期收益下限", "fundsUseWay":"资金运用方式", "ensureWay":"追加认购递增金额", "incomeDesc":"预期收益率", "trustQuit":"信托退出方式", },
    "2059":{ "FUNDCODE":"基金代码", "PRICEDATE":"价格日期", "NETVALUE":"最新净值", "TOTALVALUE":"累计净值", "TOTALBONUS":"累计分红", "BONUSDATE":"最近分红日期", "BONUSTIMES":"累计分红次数", "INCREASE_DAY":"日增长率", "INCREASE_WEEK":"周增长率", "INCREASE_MONTH":"月增长率", "INCREASE_YEAR":"年增长率", "INCREASE_CREATE":"成立以来增长率", "INCREASE_QUARTER":"季度增长率", "MRNLEVEL":"晨星评级", "FUNDSTATUS":"基金状态", },
  };

  //所有表头的映射
  $scope.allHeaderMap = {
    "3066":[{f:"prodID",w:100},{f:"prodName",w:100},{f:"trustCompanyName",w:100},{f:"publicArea",w:100},{f:"investTerm",w:100},{f:"investField",w:100},{f:"targetSize",w:100},{f:"recommendBDate",w:100},{f:"recommendEDate",w:100}],
    "2059":[ {f:"FUNDCODE",w:100}, {f:"PRICEDATE",w:100}, {f:"NETVALUE",w:100}, {f:"TOTALVALUE",w:100}, {f:"TOTALBONUS",w:100}, {f:"BONUSDATE",w:100}, {f:"BONUSTIMES",w:100}, {f:"INCREASE_DAY",w:100}, {f:"INCREASE_WEEK",w:100}, {f:"INCREASE_MONTH",w:100}, {f:"INCREASE_YEAR",w:100}, {f:"INCREASE_CREATE",w:100}, {f:"INCREASE_QUARTER",w:100}, {f:"MRNLEVEL",w:100}, {f:"FUNDSTATUS",w:100}, ],
  };

	$scope.$watch('config',function(){
    fissService.fissList($scope.config).then(function(json){
      $scope.list = json.list;
      $scope.pager = json.pager;

      angular.forEach($scope.list,function(o,j){
        for (var i in o){
          if (i == 'recommendEDate' || i == 'recommendBDate'){ o[i] = $filter("date")(o[i],"yyyy-MM-dd"); }
          else if (i == 'investField' ){ o[i] = $filter("fissInvestTypeRender")(o[i]); }
        }  
      });
    });
  },true);

	$scope.config = {
		"pageSize" : 20,
		"pageNo" : 1,
		"code" : $scope.code || "",
	};
}]);
